﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Admin_AddIntro : System.Web.UI.Page
{
    IntroductionController introductionController = new IntroductionController();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Introductions intro = new Introductions();
        intro.Title = txtTitle.Text;
        intro.Content = ckeditor.Text;
        intro.Url = txtUrl.Text;
        if(ddlStatus.SelectedIndex==0)
        {
            intro.Status = true;
        }
        else
        {
            intro.Status = false;
        }
        intro.DateStart = DateTime.Now;
        if(introductionController.Insert(intro)>0)
        {
            Response.Write("<script>alert('Thêm thành công')</script>");
            txtTitle.Text = "";
            txtUrl.Text = "";
            ckeditor.Text = "";
            ddlStatus.SelectedIndex = 0;
        }
        else
        {
            Response.Write("<script>alert('Thêm không thành công')</script>");
        }

    }
}